package com.vk.vkapiinterface.controller;

import cn.hutool.json.JSONObject;
import com.vk.vkapiclientsdk.model.User;
import com.vk.vkapiclientsdk.utils.SignUtils;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName : NameController
 * @Description : 查询名称接口控制器类
 * @Author : LYQ
 * @Date: 2023-12-08 10:39
 */
@RestController
@RequestMapping("/name")
public class NameController {

    @GetMapping("/get")
    public String getNameByGet(String name, HttpServletRequest request) {
        return "GET 你的名字是" + name;
    }

    @PostMapping("/post")
    public String getNameByPost(@RequestParam String name) {
        return "POST 你的名字是" + name;
    }

    @PostMapping("/user")
    public String getUserNameByPost(@RequestBody User user, HttpServletRequest request) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("key", user.getUsername());
        String jsonString = jsonObject.toString();
        return jsonString;
    }
}
